package com.lingxu.module.database.controller;

import com.lingxu.base.common.api.vo.Result;
import com.lingxu.module.database.entity.Model;
import com.lingxu.module.database.entity.ModelRun;
import com.lingxu.module.database.entity.SourceStcHis;
import com.lingxu.module.database.service.UseDataBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: DataBaseController
 * @Package: com.lingxu.module.database.controller
 * @Author: ysj闫世杰
 * @Email: 1105324813@qq.com
 * @Date: Created in 2023/8/1 16:53
 * @Description: 二级库数据使用流程
 * @Version: 1.0.0
 */

@RestController
@RequestMapping(value = "/use/data")
public class UseDataBaseController {

    @Autowired
    private UseDataBaseService useDataBaseService;

    //新增
    @RequestMapping(value = "/addUseDataBase")
    public Result addUseDataBase(@RequestBody SourceStcHis stcHis){
        return useDataBaseService.addUseDataBase(stcHis);
    }

    //查询待审批列表
    @RequestMapping(value = "/findNeedApprovalList")
    public Result findNeedApprovalList(Integer page,Integer limit,String state,String region){
        return useDataBaseService.findNeedApprovalList(page,limit,state,region);
    }

    //查询二级库申请详情
    @RequestMapping(value = "/findNeedApprovalDetail")
    public Result findNeedApprovalDetail(String id){
        return useDataBaseService.findNeedApprovalDetail(id);
    }

    //审批
    @RequestMapping(value = "/updateApproval")
    public Result updateApproval(@RequestBody SourceStcHis stcHis){
        return useDataBaseService.updateApproval(stcHis);
    }

    //保存申请表
    @RequestMapping(value = "/saveApprovalWord")
    public Result saveApprovalWord(@RequestBody SourceStcHis stcHis){
        return useDataBaseService.saveApprovalWord(stcHis);
    }


    //查询红名单查看权限待审批列表
    @RequestMapping(value = "/findApprovalRedPerson")
    public Result findApprovalRedPerson(Integer page,Integer limit,String state){
        return useDataBaseService.findApprovalRedPerson(page,limit,state);
    }


    //审批红名单查看权限
    @RequestMapping(value = "/updateApprovalRedPerson")
    public Result updateApprovalRedPerson(@RequestBody ModelRun modelRun){
        return useDataBaseService.updateApprovalRedPerson(modelRun);
    }
    
    /**
     * @Author ysj闫世杰
     * @Description 保存红名单申请表
     * @Date 2023/8/4 9:46 
     * @Param: 
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/updateApprovalRedPersonWord")
    public Result updateApprovalRedPersonWord(@RequestBody ModelRun mode){
        return useDataBaseService.updateApprovalRedPersonWord(mode);
    }

    //查询模型发布审批
    @RequestMapping(value = "/findModelApproval")
    public Result findModelApproval(Integer page,Integer limit,String state,String name){
        return useDataBaseService.findModelApproval(page,limit,state,name);
    }

    //模型发布审批
    @RequestMapping(value = "/updateModelApproval")
    public Result updateModelApproval(@RequestBody Model model){
        return useDataBaseService.updateModelApproval(model);
    }
}
